import fetch from 'common/src/utils/fetch';

/**
 * 查询学生关联培养方案列表
 */
export function findStudentCultureRelList(data) {
    let newData = Object.assign({}, data);
    if(newData.trainingCategory && newData.trainingCategory instanceof Array) {
      newData.trainingCategory = newData.trainingCategory.join(",");
    }
    return fetch({
        url: '/api/cultureservice/studentCultureRel/findStudentCultureRelList',
        method: 'post',
        data: newData
    });
}

/**
 * 手工取消关联培养方案
 */
export function cancelStudentCultureRelByManual(data) {
    return fetch({
        url:
            '/api/cultureservice/studentCultureRel/cancelStudentCultureRelByManual',
        method: 'put',
        data
    });
}

/**
 * 手工取消关联培养方案
 */
export function addStudentCultureRelByManual(data) {
    return fetch({
        url:
            '/api/cultureservice/studentCultureRel/addStudentCultureRelByManual',
        method: 'put',
        data
    });
}

/**
 * 手工取消关联培养方案(多个学生取消关联)
 */
export function batchCancelStudentCultureRelByManual(data) {
    return fetch({
        url:
            '/api/cultureservice/studentCultureRel/batchCancelStudentCultureRelByManual',
        method: 'put',
        data
    });
}

/**
 * 手工关联培养方案(多个学生关联)
 */
export function batchAddStudentCultureRelByManual(data) {
    return fetch({
        url:
            '/api/cultureservice/studentCultureRel/batchAddStudentCultureRelByManual',
        method: 'put',
        data
    });
}

/**
 * 查询本次需要自动绑定的学生个数
 */
export function countNeedBindSchemeStudent(data) {
    return fetch({
        url: '/api/cultureservice/studentCultureRel/countNeedBindSchemeStudent',
        method: 'post',
        data
    });
}

/**
 * 自动绑定培养方案
 */
export function bindSchemeStudent(data) {
    return fetch({
        url: '/api/cultureservice/studentCultureRel/bindSchemeStudent',
        method: 'post',
        data
    });
}

/**
 * 同步学生信息
 */
export function studentInfSchronize() {
    return fetch({
        url: '/api/cultureservice/studentCultureSchronize/studentInfSchronize',
        method: 'get'
    });
}
/**
 * 撤销审批中的培养方案
 */
export function findCourseInfoByCode(id) {
    return fetch({
        url: '/api/cultureservice/courses/findCoursesInfoByCode?code=' + id,
        method: 'get',
    })
}